In Oauth 2.0 scenario, how do you secure Oauth Client Secret and avoid Token Replay?

1) How can we assure that Oauth client secret is safe. For a pure JS web app, it cannot be stored in the client since as it becomes a public value . For an android mobile app, it can be retrieved by decompiling the app binary.

2) We have to use refresh token to keep extending the “session” time of the active user . How do we avoid the token replay issue. if clientid and refresht token are shared , then we would be issuing access tokens without any validation (like 2FA). What kind of client binding can be done to the refresh token to ensure that access tokens are only provided in the same session and to the same client.

1 1 3,070
1 REPLY 1

@rakeshapi ,

Regarding ,

1) How can we assure that Oauth client secret is safe. For a pure JS web app, it cannot be stored in the client since as it becomes a public value . For an android mobile app, it can be retrieved by decompiling the app binary.

  • If it's pure JS Web APP, Obviously you should not save client secret. That means you cannot use grant types like Client Credentials. You need to use Implicit Grant Type where you don't need client secret.
  • Regarding, Android App, Above concept still applies. You can use grant types like resource owner password credentials in trusted apps scenario.

2) We have to use refresh token to keep extending the “session” time of the active user . How do we avoid the token replay issue. if clientid and refresh token are shared , then we would be issuing access tokens without any validation (like 2FA). What kind of client binding can be done to the refresh token to ensure that access tokens are only provided in the same session and to the same client.

Hope it helps.