Originally posted by **mahith2108** May 23, 2024
Hi,
we are using **Java sdk version **"4.0.5.Final"** and spec version: 0.8** as suggested (https://github.com/serverlessworkflow/sdk-java)
I am trying to define Oauth properties using "auth" field in my spec as follows based on https://github.com/serverlessworkflow/specification/discussions/675
```json
"auth":[
{ "name" : "serviceCloud",
"scheme": "oauth2",
"properties":{
"scopes": ["$$$$XXXMMMMM"],
"audiences":["%%%XXXXXXX"]
}
}]
```
while parsing the spec using `Workflow.fromSource("")` I am getting following error.
```log
Could not convert markup to Workflow: Unrecognized field "scopes" (class io.serverlessworkflow.api.auth.BasicAuthDefinition), not marked as ignorable (3 known properties: "password", "username", "metadata"])
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.serverlessworkflow.api.Workflow["auth"]->io.serverlessworkflow.api.auth.BasicAuthDefinition["scopes"])
```
we have tried following spec as well but the authDefinition.getOauth() is coming as null.
```json
"auth":[
{ "name" : "serviceCloud",
"scheme": "oauth2",
"oauth":{
"scopes": ["%%%%%X"],
"audiences":["%%%XXXXXX"]
}
}]
```
```java
@JsonPropertyOrder({"name", "scheme", "basicauth", "bearerauth", "oauth"})
public class AuthDefinition implements Serializable {
```
Discussed in https://github.com/serverlessworkflow/specification/discussions/857
@mahith2108, FYI
grantType
andclientId
are required for OAuth: https://github.com/serverlessworkflow/specification/blob/0.8.x/schema/auth.json#L191I'll fix this validation and make sure the object conforms with the spec, thou.
thanks