I need authorizationcode

{"code":"4/yU4cQZTMnnMtetyFcIWNItG32eKxxxgXXX-Z4yyJJJo.4qHskT-UtugceFc0ZRONyF4z7U4UmAI"}

like this in response for refresh token

  {
  provide: 'SocialAuthServiceConfig',
  useValue: {
    autoLogin: true,
    providers: [
      {
        id: GoogleLoginProvider.PROVIDER_ID,
        provider: new GoogleLoginProvider(CLIENT_ID, {
          response_type: 'authorization_code',
          access_type: 'offline',
        }),
      },
    ],
   } as SocialAuthServiceConfig,
  }
1

There are 1 best solutions below

0
Linda Lawton - DaImTo On

You need to understand how Oauth2 works When the user consents to your access then authorization code is returned.

Your application then recieves the authorization code and exchanges it with the authorization server for an access token and a refreshtoken.

The access token can be used to access Google apis, and private user data. However this token is short lived it will only work for an hour.

The refresh token is long lived and can be used to request a new access token after it has expired.

I need authorizationcode like this in response for refresh token

So in response to this statement the refresh token response will never return an authorization code. Only the request for consent of the user the first step in the flow will return an authorization code.

If you are interested in seeing how Oauth2 works this may interst you. Understanding Oauth2 with curl.