Как имитировать полный рабочий процесс аутентификации Google oauth2 с помощью Wiremock?Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Как имитировать полный рабочий процесс аутентификации Google oauth2 с помощью Wiremock?

Сообщение Anonymous »


I have a situation where I need to mock entire google drive workflow for internal testing. We don't want to use actual service account for testing. I use wiremock and mocked (or I think) following api requests.
  • Auth Endpoint:

request": { "method": "GET", "urlPattern": ".*/o/oauth2/v2/auth.*", "headers": { "Host": { "equalTo": "accounts.google.com" } } }, "response": { "status": 302, "headers": { "Location": "callbackurl" }
  • Redirect Endpoint:
request": { "method": "GET", "urlPattern": ".*/suite/oauth/callback.*" }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": "callback is succesful" } }
  • Token Endpoint:
{ "request": { "method": "POST", "url": "/token", "headers" : { "Host" : { "equalTo" : "oauth2.googleapis.com" } } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "body": "{ \"access_token\": \"your_access_token\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"refresh_token\": \"your_refresh_token\" }" } } However this works when I hit the endpoint from postman or python script. But this does not work when I try to use my actual application (I have enabled the proxy with the wiremock) it opens a new tab in chrome and it throws error. The url is exactly same on what I test using postman and this application. The problem is the request in the application gets opened in a new window

You can’t sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error If you are a developer of this app, see error details. Error 400: redirect_uri_mismatch Do you have any idea?


Источник: https://stackoverflow.com/questions/774 ... g-wiremock
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Wiremock проверяйте потерянный нитолокальный контекст в Quarkus 3.19.1 и Wiremock 3.0.1
    Anonymous » » в форуме JAVA
    0 Ответы
    7 Просмотры
    Последнее сообщение Anonymous
  • В параллельном коде на Python рабочий процесс, который завершает задачу позже, чем другой рабочий, сначала получает блок
    Гость » » в форуме Python
    0 Ответы
    140 Просмотры
    Последнее сообщение Гость
  • Рабочий процесс Spring-Boot-OAuth2 с обменом кодом на JWT
    Anonymous » » в форуме JAVA
    0 Ответы
    3 Просмотры
    Последнее сообщение Anonymous
  • Рабочий процесс Spring-Boot-OAuth2 с обменом кодом на JWT
    Anonymous » » в форуме JAVA
    0 Ответы
    3 Просмотры
    Последнее сообщение Anonymous
  • Рабочий процесс Spring-Boot-OAuth2 с обменом кодом на JWT
    Anonymous » » в форуме JAVA
    0 Ответы
    2 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»